/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// pegtypes.hpp - Basic data types used by the PEG library.
//
// Author: Kenneth G. Maxwell
//         Jim DeLisle
//
// Copyright (c) 1997-2003 Swell Software 
//              All Rights Reserved.
//
// Unauthorized redistribution of this source code, in whole or part,
// without the express written permission of Swell Software
// is strictly prohibited.
//
// Notes:
//
// This file contains object types, style flags, and signals used by the
// entire library. Miscelleneous other definitions and macros are also
// contained withing this file.
//
// The basic data types used by PEG are also contained in this file. These 
// include PegPoint, PegRect, PegColor, PegBitmap, PegCapture, etc...
// 
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef _PEGTYPES_
#define _PEGTYPES_


/*--------------------------------------------------------------------------*/
// Fundamental data types
//
// The data types used by PEG are:
//
//  PEGCHAR     signed  character
//  PEGUBYTE    unsigned character
//  PEGUINT     unsigned int
//  PEGINT      signed int
//  PEGUSHORT   unsigned 16 bit
//  PEGSHORT    signed 16 bit
//  PEGLONG     signed 32-bit
//  PEGULONG    unsigned 32-bit
//  PEGCOLOR    8-24bit unsigned, depends on color depth
//
//  The remaining PEG types are defined using these values.
//
//  When possible, PEG uses PEGINT and PEGUINT data types, to make the best
//  use of the local machine types.
//
/*--------------------------------------------------------------------------*/


#ifndef NULL
#define NULL 0
#endif

#if !defined(PEGSMX) && !defined(PEGMQX) && !defined(PEG_ITRON)

#if !defined(TRUE)
#define TRUE 1
#endif

#if !defined(FALSE)
#define FALSE 0
#endif

#endif

#if defined(PEG_ITRON)
#undef NULL
#define NULL 0
#endif

/*--------------------------------------------------------------------------*/
// The PEGBYTE is an 8 bit signed type.
/*--------------------------------------------------------------------------*/

typedef signed char PEGBYTE;

/*--------------------------------------------------------------------------*/
// The PEGUBYTE is an 8 bit unsigned type
/*--------------------------------------------------------------------------*/

typedef unsigned char PEGUBYTE;    // 8 bit unsigned

/*--------------------------------------------------------------------------*/
// The PEGINT datatype can be 16 or 32 bits, signed. 
// Smaller code space and better performance result from
// using the native "int" type for PEGINT, but we allow you to
// alter this if required.
/*--------------------------------------------------------------------------*/

typedef signed int PEGINT;         // native signed type

/*--------------------------------------------------------------------------*/
// The PEGUINT datatype can be 16 or 32 bits, unsigned. 
// Smaller code space and better performance result from
// using the native "int" type for PEGUINT, but we allow you to
// alter this if required.
/*--------------------------------------------------------------------------*/

typedef unsigned int PEGUINT;      // native unsigned type

/*--------------------------------------------------------------------------*/
// The PEGUSHORT datatype, 16 bits unsigned. 
/*--------------------------------------------------------------------------*/

typedef unsigned short PEGUSHORT;  // unsigned 16-bit type

/*--------------------------------------------------------------------------*/
// The PEGSHORT datatype, 16 bits signed. 
/*--------------------------------------------------------------------------*/

typedef signed short PEGSHORT;     // signed 16-bit type

/*--------------------------------------------------------------------------*/
// The PEGLONG datatype is a 32 bit signed type.
/*--------------------------------------------------------------------------*/

typedef signed long PEGLONG;       // 32 bit signed

/*--------------------------------------------------------------------------*/
// The PEGULONG datatype is a 32 bit unsigned type.
/*--------------------------------------------------------------------------*/

typedef unsigned long PEGULONG;    // 32 bit unsigned

/*--------------------------------------------------------------------------*/
// The PEGFLOAT datatype is a float.
/*--------------------------------------------------------------------------*/
#if defined(PEG_OPENGL_MULTIPLE_SURFACES) || defined(PEG_OPENGL_SINGLE_SURFACE)

typedef float PEGFLOAT;            // float

#endif // PEG_OPENGL_MULTIPLE_SURFACES || PEG_OPENGL_SINGLE_SURFACE


/*--------------------------------------------------------------------------*/
// The PEGBOOL datatype is a native int data type
/*--------------------------------------------------------------------------*/

typedef signed int PEGBOOL;


/*--------------------------------------------------------------------------*/
// The PEGCT data type
/*--------------------------------------------------------------------------*/
#if defined(PEGCT_IS_SIGNED)
typedef signed char PEGCT;          // Explicitly signed
#elif defined (PEGCT_IS_UNSIGNED)
typedef unsigned char PEGCT;        // Explicitly unsigned
#else
typedef char PEGCT;                 // Use compiler default
#endif

/*--------------------------------------------------------------------------*/
// The PEGCHAR data type
/*--------------------------------------------------------------------------*/
#ifdef PEG_UNICODE
 #ifndef PEGWIDECHAR                    // type defined in pconfig.hpp??
  #define PEGWIDECHAR unsigned short    // no, use our default type
 #endif
typedef PEGWIDECHAR PEGCHAR;            // 16 bit unsigned for UNICODE
#else
typedef PEGCT  PEGCHAR;        // 8 bit (preferably) unsigned, no UNICODE
#endif



/*--------------------------------------------------------------------------*/
// Obsolete data types. These data types are no longer used by the PEG
// library and should not be used by new applications. If you have a large
// existing application using these obsolete types, they can be defined
// here.
/*--------------------------------------------------------------------------*/
#if defined(PEG_OBSOLETE_TYPES)

#if !defined(PEGWIN32)

typedef PEGUSHORT WORD;
typedef PEGULONG  DWORD;
typedef PEGUBYTE  UCHAR;
typedef PEGLONG   LONG;
typedef PEGBOOL   BOOL;
#endif

typedef PEGSHORT SIGNED;

#if !defined(PEG_OSE)
typedef PEG_SIGNAL SIGNAL;
#endif

#endif

/*--------------------------------------------------------------------------*/
// _ltoa() is provided internally by PEG if the definition of USE_PEG_LTOA
// is enabled.
/*--------------------------------------------------------------------------*/

#if defined(USE_PEG_LTOA) || defined(PEG_UNICODE)
PEGCHAR * PegLtoA(long val, PEGCHAR *s, int rad);
#else
#define PegLtoA(a, b, c) _ltoa(a, b, c)
#endif

#if defined(PEG_UNICODE)
PEGCT * PegLtoA(long val, PEGCT *s, int rad);
#endif


#if defined(PEG_STRLIB)

PEGCHAR *PegStrCat(PEGCHAR *s1, const PEGCHAR *s2);
PEGCHAR *PegStrnCat(PEGCHAR *s1, const PEGCHAR *s2, int iMax);
PEGCHAR *PegStrCpy(PEGCHAR *s1, const PEGCHAR *s2);
PEGCHAR *PegStrnCpy(PEGCHAR *s1, const PEGCHAR *s2, int iMax);
int      PegStrCmp(const PEGCHAR *s1, const PEGCHAR *s2);
int      PegStrnCmp(const PEGCHAR *s1, const PEGCHAR *s2, int iMax);
int      PegStrLen(const PEGCHAR *s1);
PEGLONG  PegAtoL(const PEGCHAR *s1);
int      PegAtoI(const PEGCHAR *s1);

#ifdef PEG_UNICODE

int      PegStrCmp(const PEGCT *s1, const PEGCT *s2);
int      PegStrnCmp(const PEGCT *s1, const PEGCT *s2, int iMax);
int      PegStrLen(const PEGCT *s1);
int      PegAtoI(const PEGCT *s1);
long     PegAtoL(const PEGCT *s1);
PEGCT   *PegStrCpy(PEGCT *s1, const PEGCT *s2);
PEGCT   *PegStrnCpy(PEGCT *s1, const PEGCT *s2, int iMax);
PEGCT   *PegStrCat(PEGCT *s1, const PEGCT *s2);
PEGCT   *PegStrnCat(PEGCT *s1, const PEGCT *s2, int iMax);

PEGCHAR *PegStrCpy(PEGCT *s1, const PEGCHAR *s2);
PEGCHAR *PegStrCpy(PEGCHAR *s1, const PEGCT *s2);
PEGCT   *PegStrnCpy(PEGCT *s1, const PEGCHAR *s2, int iMax);
PEGCHAR *PegStrnCpy(PEGCHAR *s1, const PEGCT *s2, int iMax);
PEGCT   *PegStrCat(PEGCT *s1, const PEGCHAR *s2);
PEGCHAR *PegStrCat(PEGCHAR *s1, const PEGCT *s2);
PEGCT   *PegStrnCat(PEGCT *s1, const PEGCHAR *s2, int iMax);
PEGCHAR *PegStrnCat(PEGCHAR *s1, const PEGCT *s2, int iMax);

#endif // PEG_UNICODE

#else  // PEG_STRLIB is not defined, used standard C library:

#define PegStrCat(a, b) strcat(a, b)
#define PegStrnCat(a, b, c) strncat(a, b, c)
#define PegStrCpy(a, b) strcpy(a, b)
#define PegStrnCpy(a, b, c) strncpy(a, b, c)
#define PegStrCmp(a, b) strcmp(a, b)
#define PegStrnCmp(a, b, c) strncmp(a, b, c)
#define PegStrLen(a) strlen(a)
#define PegAtoL(a) atol(a)
#define PegAtoI(a) atoi(a)


#endif  // PEG_STRLIB


#ifdef PEG_UNICODE
void     UnicodeToAscii(PEGCT *s1, const PEGCHAR *s2);
void     AsciiToUnicode(PEGCHAR *s1, const PEGCT *s2);
#endif  // PEG_UNICODE

/*--------------------------------------------------------------------------*/
// ROMDATA- data storage qualifier used to put bitmaps, fonts, and string
// literals in ROM. May have to be re-defined for your compiler/linker.
/*--------------------------------------------------------------------------*/
#define ROMDATA  const


/*--------------------------------------------------------------------------*/
// PEG_SJIS_CONVERSION- Functions to convert between SJIS and Unicode
/*--------------------------------------------------------------------------*/

#ifdef PEG_SJIS_CONVERSION

void SJISToUnicode(PEGCHAR *s1);
void SJISToUnicode(PEGCHAR *s1, const PEGCHAR *s2);
PEGCHAR SJISToUnicode(PEGCHAR c1);
void UnicodeToSJIS(PEGCHAR *s1);
void UnicodeToSJIS(PEGCHAR *s1, const PEGCHAR *s2);
PEGCHAR UnicodeToSJIS(PEGCHAR c1);

#endif

/*--------------------------------------------------------------------------*/
// PEG_BIG5_CONVERSION- Functions to convert between BIG5 and Unicode
/*--------------------------------------------------------------------------*/

#ifdef PEG_BIG5_CONVERSION

void Big5ToUnicode(PEGCHAR *s1);
void Big5ToUnicode(PEGCHAR *s1, const PEGCHAR *s2);
PEGCHAR Big5ToUnicode(PEGCHAR c1);
void UnicodeToBig5(PEGCHAR *s1);
void UnicodeToBig5(PEGCHAR *s1, const PEGCHAR *s2);
PEGCHAR UnicodeToBig5(PEGCHAR c1);

#endif

/*--------------------------------------------------------------------------*/
// PEGCOLOR- size of this data type depends on number of output colors
/*--------------------------------------------------------------------------*/

#if !defined(PEG_NUM_COLORS)

#ifdef PEGWIN32
typedef PEGUBYTE PEGCOLOR;
#else
typedef PEGULONG PEGCOLOR;
#endif

#elif (PEG_NUM_COLORS > 65535L)
typedef PEGULONG PEGCOLOR;
#elif (PEG_NUM_COLORS > 256)
typedef PEGUSHORT PEGCOLOR;  // on embedded target, PEGUSHORT should be defined as 16-bits
#else
typedef PEGUBYTE PEGCOLOR;
#endif


/*--------------------------------------------------------------------------*/
// Thing types- These values are found in the uType member of all Peg
// GUI objects, and can be queried via the Type() function.
/*--------------------------------------------------------------------------*/

const PEGUSHORT TYPE_THING              = 1;
const PEGUSHORT TYPE_TITLE              = 2;
const PEGUSHORT TYPE_MENU               = 3;
const PEGUSHORT TYPE_BUTTON             = 5;
const PEGUSHORT TYPE_HSCROLL            = 6;
const PEGUSHORT TYPE_VSCROLL            = 7;
const PEGUSHORT TYPE_ICON               = 8;
const PEGUSHORT TYPE_MENU_BAR           = 9;
const PEGUSHORT TYPE_MENU_BUTTON        = 10;
const PEGUSHORT TYPE_TEXTBUTTON         = 11;
const PEGUSHORT TYPE_ICONBUTTON         = 12;
const PEGUSHORT TYPE_BMBUTTON           = 13;
const PEGUSHORT TYPE_RADIOBUTTON        = 14;
const PEGUSHORT TYPE_CHECKBOX           = 15;
const PEGUSHORT TYPE_STATUS_BAR         = 16;
const PEGUSHORT TYPE_PROMPT             = 17;
const PEGUSHORT TYPE_VPROMPT            = 18;
const PEGUSHORT TYPE_PROGRESS_BAR       = 19;
const PEGUSHORT TYPE_SCROLL_PROMPT      = 20;
const PEGUSHORT TYPE_BMSLIDER           = 21;
const PEGUSHORT TYPE_EDIT_FIELD         = 22;
const PEGUSHORT TYPE_SLIDER             = 23;
const PEGUSHORT TYPE_SPINBUTTON         = 24;
const PEGUSHORT TYPE_GROUP              = 25;
const PEGUSHORT TYPE_MLTEXTBUTTON       = 26;
const PEGUSHORT TYPE_TOOL_BAR_PANEL     = 27;
const PEGUSHORT TYPE_TOOL_BAR           = 28;
const PEGUSHORT TYPE_DECORATEDBUTTON    = 29;
const PEGUSHORT TYPE_ANIMATION          = 30;
const PEGUSHORT TYPE_PASSWD_FIELD       = 31;
const PEGUSHORT TYPE_BITMAP_PROMPT      = 32;
const PEGUSHORT TYPE_BMPDECBUTTON       = 33;


/*--------------------------------------------------------------------------*/
// Chart types- only include if PEG_CHARTING is defined
/*--------------------------------------------------------------------------*/

#ifdef PEG_CHARTING

const PEGUSHORT TYPE_LINE_CHART         = 40;
const PEGUSHORT TYPE_STRIP_CHART        = 41;
const PEGUSHORT TYPE_MULTI_LINE_CHART   = 42;

#endif

/*--------------------------------------------------------------------------*/
// HMI types- only include if PEG_HMI_GADGETS is defined
/*--------------------------------------------------------------------------*/

#ifdef PEG_HMI_GADGETS

const PEGUSHORT TYPE_FDIAL              = 50;
const PEGUSHORT TYPE_FBM_DIAL           = 51;
const PEGUSHORT TYPE_OLD_CLR_LIGHT      = 52;
const PEGUSHORT TYPE_OLD_BM_LIGHT       = 53;
const PEGUSHORT TYPE_OLD_LIN_SCALE      = 54;
const PEGUSHORT TYPE_OLD_LIN_BM_SCALE   = 55;

const PEGUSHORT TYPE_CDIAL              = 56;
const PEGUSHORT TYPE_CBM_DIAL           = 57;

#endif

/*--------------------------------------------------------------------------*/
// ... leave twenty additional types for future gadgets ...
//
// Note: It isn't critical if the class types need to be renumbered at
// some point. Only WindowBuilder project files would be affected.
//
/*--------------------------------------------------------------------------*/

const PEGUSHORT LAST_PEG_CONTROL_TYPE   = 0x00ff;

const PEGUSHORT FIRST_USER_CONTROL_TYPE = 0x0100;


/*--------------------------------------------------------------------------*/
// Thing types for classes derived from PegWindow. The library performs
// slightly different processing on PegWindow derived classes.
/*--------------------------------------------------------------------------*/

const PEGUSHORT TYPE_WINDOW             = 0x0200;
const PEGUSHORT TYPE_DIALOG             = 0x0201;
const PEGUSHORT TYPE_TABLE              = 0x0202;
const PEGUSHORT TYPE_SPREADSHEET        = 0x0203;
const PEGUSHORT TYPE_TEXTBOX            = 0x0204;
const PEGUSHORT TYPE_MSG_WIN            = 0x0205;
const PEGUSHORT TYPE_DECORATED_WIN      = 0x0206;
const PEGUSHORT TYPE_ANIMATION_WIN      = 0x0207;
const PEGUSHORT TYPE_NOTEBOOK           = 0x0208;
const PEGUSHORT TYPE_TREEVIEW           = 0x0209;
const PEGUSHORT TYPE_TERMINAL_WIN       = 0x020a;
const PEGUSHORT TYPE_LIST               = 0x020b;
const PEGUSHORT TYPE_VLIST              = 0x020c;
const PEGUSHORT TYPE_HLIST              = 0x020d;
const PEGUSHORT TYPE_COMBO              = 0x020e;
const PEGUSHORT TYPE_EDITBOX            = 0x020f;
const PEGUSHORT TYPE_ML_MSG_WIN         = 0x0210;
const PEGUSHORT TYPE_VVLIST             = 0x0211;
const PEGUSHORT TYPE_COMBO_LIST         = 0x0212;
const PEGUSHORT TYPE_TEXT_COMBO         = 0x0213;

#if defined(PEG_OPERA_SUPPORT)
const PEGUSHORT TYPE_OPERA_WINDOW       = 0x0240;
#endif  // PEG_OPERA_SUPPORT

const PEGUSHORT FIRST_USER_WINDOW_TYPE  = 0x0300;
const PEGUSHORT LAST_USER_WINDOW_TYPE   = 0x03ff;

/*--------------------------------------------------------------------------*/
// Reserved button IDs. Buttons with these IDs are treated specially by modal
// dialog and modal message window.
/*--------------------------------------------------------------------------*/

const PEGUSHORT IDB_CLOSE    = 1000;
const PEGUSHORT IDB_SYSTEM   = 1001;
const PEGUSHORT IDB_OK       = 1002;
const PEGUSHORT IDB_CANCEL   = 1003;
const PEGUSHORT IDB_APPLY    = 1004;
const PEGUSHORT IDB_ABORT    = 1005;
const PEGUSHORT IDB_YES      = 1006;
const PEGUSHORT IDB_NO       = 1007;
const PEGUSHORT IDB_RETRY    = 1008;


/*--------------------------------------------------------------------------*/
// The object style flags. These flags change the appearance and operation of
// many PEG object types.
/*--------------------------------------------------------------------------*/

// frame styles:

const PEGULONG FF_NONE            = 0x00000001;
const PEGULONG FF_THIN            = 0x00000002;

const PEGULONG FF_RAISED          = 0x00000004;
const PEGULONG FF_RECESSED        = 0x00000008;

const PEGULONG FF_THICK           = 0x00000010;
const PEGULONG FF_MASK            = 0x0000001f;

// Text Justification Style:

const PEGULONG TJ_RIGHT           = 0x00000020;
const PEGULONG TJ_LEFT            = 0x00000040;
const PEGULONG TJ_CENTER          = 0x00000080;
const PEGULONG TJ_MASK            = 0x000000E0;

// Title Style:

const PEGULONG TF_NONE            = 0x00000000;
const PEGULONG TF_SYSBUTTON       = 0x00000200;
const PEGULONG TF_MINMAXBUTTON    = 0x00000400;
const PEGULONG TF_CLOSEBUTTON     = 0x00000800;

// Text Thing Copy Flag

const PEGULONG TT_COPY            = 0x10000000;

// List Style

const PEGULONG LS_WRAP_SELECT     = 0x00002000;

// Button Style:

const PEGULONG BF_REPEAT          = 0x00010000;
const PEGULONG BF_PUSHED          = 0x00020000;
const PEGULONG BF_DOWNACTION      = 0x00040000;
const PEGULONG BF_TOGGLE          = 0x00100000;
const PEGULONG BF_EXCLUSIVE       = 0x00200000;
const PEGULONG BF_FLYOVER         = 0x00400000;

// Bitmap Button Justification Style:

const PEGULONG BF_BMRIGHT         = 0x00000020;
const PEGULONG BF_BMLEFT          = 0x00000040;
const PEGULONG BF_BMHCENTER       = 0x00000080;
const PEGULONG BF_BMVCENTER       = 0x00000100;
const PEGULONG BF_BMTOP           = 0x00000200;
const PEGULONG BF_BMBOTTOM        = 0x00000400;
const PEGULONG BF_BMJUSTIFY_MASK  = 0x000007E0;

// menu button style

const PEGULONG BF_SEPARATOR       = 0x00000100;
const PEGULONG BF_CHECKABLE       = 0x00000200;
const PEGULONG BF_CHECKED         = 0x00000400;
const PEGULONG BF_DOTABLE         = 0x00000800;
const PEGULONG BF_DOTTED          = 0x00001000;

// Decorated Button styles. 

const PEGULONG BF_ORIENT_TR       = 0x00000800;
const PEGULONG BF_ORIENT_BR       = 0x00001000;

// Edit Style:

const PEGULONG EF_EDIT            = 0x00000100;
const PEGULONG EF_PARTIALROW      = 0x00000200;
const PEGULONG EF_WRAP            = 0x00000400;
const PEGULONG EF_FULL_SELECT     = 0x00000800;

// Message Window Style:

const PEGULONG MW_OK              = 0x00000020;
const PEGULONG MW_YES             = 0x00000040;
const PEGULONG MW_NO              = 0x00000080;
const PEGULONG MW_ABORT           = 0x00000100;
const PEGULONG MW_RETRY           = 0x00000200;
const PEGULONG MW_CANCEL          = 0x00000400;

// Table Style:

const PEGULONG TS_SOLID_FILL      = 0x00000100;
const PEGULONG TS_PARTIAL_COL     = 0x00000200;
const PEGULONG TS_PARTIAL_ROW     = 0x00000400;
const PEGULONG TS_DRAW_HORZ_GRID  = 0x00001000;
const PEGULONG TS_DRAW_VERT_GRID  = 0x00002000;
const PEGULONG TS_DRAW_GRID       = 0x00003000;

// Table Cell Style:

const PEGULONG TCF_FORCEFIT       = 0x00000001;
const PEGULONG TCF_HCENTER        = 0x00000100;
const PEGULONG TCF_HLEFT          = 0x00000200;
const PEGULONG TCF_HRIGHT         = 0x00000400;
const PEGULONG TCF_VCENTER        = 0x00000800;
const PEGULONG TCF_VTOP           = 0x00001000;
const PEGULONG TCF_VBOTTOM        = 0x00002000;

// Spreadsheet basic Styles:

const PEGULONG SS_CELL_SELECT     = 0x00000400;
const PEGULONG SS_PARTIAL_COL     = 0x00000800;
const PEGULONG SS_MULTI_ROW_SELECT= 0x00001000;
const PEGULONG SS_MULTI_COL_SELECT= 0x00002000;

// Spreadsheet Column Styles

const PEGULONG SCF_ALLOW_SELECT   = 0x00000100;
const PEGULONG SCF_SELECTED       = 0x00000200;
const PEGULONG SCF_SEPARATOR      = 0x00000400;
const PEGULONG SCF_CELL_SELECT    = 0x00000800;

// Spreadsheet Row Styles

const PEGULONG SRF_ALLOW_SELECT   = 0x00000100;
const PEGULONG SRF_SELECTED       = 0x00000200;
const PEGULONG SRF_SEPARATOR      = 0x00000400;
const PEGULONG SRF_CELL_SELECT    = 0x00000800;

// Notebook Styles:

const PEGULONG NS_TOPTABS         = 0x00000100;        
const PEGULONG NS_BOTTOMTABS      = 0x00000200;
const PEGULONG NS_TEXTTABS        = 0x00000400;

// Slider Style:

const PEGULONG SF_SNAP            = 0x00000100;
const PEGULONG SF_SCALE           = 0x00000200;
const PEGULONG SS_FACELEFT        = 0x00000020;
const PEGULONG SS_FACETOP         = 0x00000020;
const PEGULONG SS_BOTTOMTOTOP     = 0x00000040;
const PEGULONG SS_LEFTTORIGHT     = 0x00000040;
const PEGULONG SS_ORIENTVERT      = 0x00000080;
const PEGULONG SS_TICMARKS        = 0x00000100;
const PEGULONG SS_USERTRACK       = 0x00000200;
const PEGULONG SS_USERTRAVEL      = 0x00000400;
const PEGULONG SS_THINNEEDLE      = 0x00000800;
const PEGULONG SS_THICKNEEDLE     = 0x00001000;
const PEGULONG SS_POLYNEEDLE      = 0x00002000;
const PEGULONG SS_FACERIGHT       = 0x00004000;
const PEGULONG SS_FACEBOTTOM      = 0x00004000;

const PEGULONG SS_STANDARDSTYLE   = SS_FACELEFT|SS_BOTTOMTOTOP|
                                    SS_ORIENTVERT| SS_TICMARKS|
                                    SS_POLYNEEDLE;

// Progress Bar Style:

const PEGULONG PS_SHOW_VAL        = 0x00000100;
const PEGULONG PS_RECESSED        = 0x00000200;
const PEGULONG PS_LED             = 0x00000400;
const PEGULONG PS_VERTICAL        = 0x00000800;
const PEGULONG PS_PERCENT         = 0x00001000;

// Spin Button Style:

const PEGULONG SB_VERTICAL        = 0x00001000;

// Scroll Bar Style

const PEGULONG SB_END_BUTTONS     = 0x00001000;
const PEGULONG SB_TILE_BKG        = 0x00002000;
const PEGULONG SB_TILE_THUMB      = 0x00004000;
const PEGULONG SB_RELATIVE_THUMB  = 0x00008000;

// Scroll Prompt Style:

const PEGULONG SP_ONFOCUS         = 0x00001000;      // begin scrolling when focus received
const PEGULONG SP_ALWAYS          = 0x00002000;      // begin scrolling immediately
const PEGULONG SP_CONTINUOUS      = 0x00004000;      // scroll continously  (else one-shot)
const PEGULONG SP_DOTDOT          = 0x00008000;      // appends "..." to string end
const PEGULONG SP_WRAP            = 0x00010000;      // wraps end-to-start with space
const PEGULONG SP_ON_MASK         = 0x00003000;
const PEGULONG SP_MASK            = 0x0001F000;

// Toobar Panel style:

const PEGULONG TP_AUTOSIZE        = 0x00000800;


#ifdef PEG_HMI_GADGETS

// PegDial styles:

const PEGULONG DS_CLOCKWISE       = 0x00000020;
const PEGULONG DS_TICMARKS        = 0x00000040;
const PEGULONG DS_THINNEEDLE      = 0x00000080;
const PEGULONG DS_THICKNEEDLE     = 0x00000100;
const PEGULONG DS_POLYNEEDLE      = 0x00000200;
const PEGULONG DS_RECTCOR         = 0x00000400;
const PEGULONG DS_USERCOR         = 0x00000800;


const PEGULONG DS_STANDARDSTYLE   = DS_THINNEEDLE|DS_RECTCOR|DS_TICMARKS|
                                      DS_CLOCKWISE;

// PegLight styles:

const PEGULONG LS_RECTANGLE       = 0x00000100;
const PEGULONG LS_CIRCLE          = 0x00000200;

#endif  // PEG_HMI_GADGETS


// Miscellaneous Appearance Style:

const PEGULONG AF_SIZEABLE         = 0x01000000;
const PEGULONG AF_MOVEABLE         = 0x02000000;
const PEGULONG AF_DRAW_SELECTED    = 0x20000000;
const PEGULONG AF_TRANSPARENT      = 0x40000000;
const PEGULONG AF_ENABLED          = 0x80000000;


/*--------------------------------------------------------------------------*/
// Extended style defines for PEG_CHARTING classes. These are NOT PegThing
// Style() flags, these are extended style flags used only with PegChart
// classes.
/*--------------------------------------------------------------------------*/
#ifdef PEG_CHARTING

const PEGULONG CS_DRAWXGRID        = 0x00000100;
const PEGULONG CS_DRAWYGRID        = 0x00000200;
const PEGULONG CS_DRAWXTICS        = 0x00000400;
const PEGULONG CS_DRAWYTICS        = 0x00000800;
const PEGULONG CS_AUTOSIZE         = 0x00001000;
const PEGULONG CS_SCROLLED         = 0x00002000;
const PEGULONG CS_PAGED            = 0x00004000;
const PEGULONG CS_DRAWXAXIS        = 0x00008000;
const PEGULONG CS_DRAWAGED         = 0x00010000;
const PEGULONG CS_DRAWLEADER       = 0x00020000;
const PEGULONG CS_DUALYTICS        = 0x00040000;
const PEGULONG CS_DUALYLABELS      = 0x00080000;
const PEGULONG CS_XAXISONZEROY     = 0x00100000;
const PEGULONG CS_DRAWLINEFILL     = 0x00200000;
const PEGULONG CS_DRAWXLABELS      = 0x00400000;
const PEGULONG CS_DRAWYLABELS      = 0x00800000;

#endif
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#if defined(PEG_OPERA_SUPPORT)

const PEGULONG OP_AUTO_SIZE_TO_PARENT   = 0x00000100;

#endif  // PEG_OPERA_SUPPORT

/*--------------------------------------------------------------------------*/
// Gradient style defines for the PegGradient classes. These are NOT PegThing
// Style() flags, these are style flags defining the properties of a gradient.
/*--------------------------------------------------------------------------*/
const PEGULONG GS_VERTICAL         = 0x00000001;
const PEGULONG GS_HORIZONTAL       = 0x00000002;
const PEGULONG GS_ULTOLR           = 0x00000004;
const PEGULONG GS_LLTOUR           = 0x00000008;
const PEGULONG GS_RADIAL           = 0x00000010;
const PEGULONG GS_TYPEMASK         = 0x0000001f;

const PEGULONG GS_COSINE           = 0x00000020;
const PEGULONG GS_REVERSE          = 0x00000040;
const PEGULONG GS_DITHERED         = 0x00000080;


/*--------------------------------------------------------------------------*/
// PEG signal definitions. PegBaseSignals are supported by all objects. The
// remaining signals are only supported by the object type indicated in the
// enumeration name.
/*--------------------------------------------------------------------------*/
enum PegBaseSignals {
    PSF_SIZED = 0,          // sent when the object is moved or sized
    PSF_FOCUS_RECEIVED,     // sent when the object receives input focus
    PSF_FOCUS_LOST,         // sent when the object loses input focus
    PSF_KEY_RECEIVED,       // sent when an input key that is not supported is received
    PSF_CLICKED,            // default left-click notification
    PSF_RIGHTCLICK          // sent when a right-click message is received by the object
};

enum PegTextSignals {
    PSF_TEXT_SELECT    = 8, // sent when the user selects all or a portion of a text object
    PSF_TEXT_EDIT,          // sent each time text object string is modified
    PSF_TEXT_EDITDONE,      // sent when a text object modification is complete
    PSF_SCROLL_COMPLETE     // sent by PegScrollPrompts when scrolling is complete in 1-shot mode
};

enum PegButtonSignals {
    PSF_CHECK_ON = 8,           // sent by check box and  menu button when checked
    PSF_CHECK_OFF,          // sent by check box and menu button when unchecked
    PSF_DOT_ON,             // sent by radio button and menu button when selected
    PSF_DOT_OFF,            // sent by radio button and menu button when unselected
    PSF_LIST_SELECT         // sent by PegList derived objects, including PegComboBox
};

enum PegScrollSignals {
    PSF_SCROLL_CHANGE = 8,  // sent by non-client PegScroll derived objects
    PSF_SLIDER_CHANGE       // sent by PegSlider derived objects
};

enum PegSpinSignals {
    PSF_SPIN_MORE     = 8,  // sent by PegSpinButton on down or right
    PSF_SPIN_LESS           // sent by PegSpinButton on up or left
};

enum PegSpreadsheetSignals {
    PSF_COL_SELECT = 8,     // sent when SpreadSheet column is selected
    PSF_COL_DESELECT,       // send when SpreadSheet column is deselected
    PSF_ROW_SELECT,         // sent when SpreadSheet row is selected
    PSF_ROW_DESELECT,       // sent when SpreadSheet row is deselected
    PSF_CELL_SELECT         // sent when SpreadSheet cell(s) are selected
    // PSF_CELL_RCLICK      // sent when Right-Click on cell (not yet supported)
};

enum PegNotebookSignals {
    PSF_PAGE_SELECT = 8     // send whan a new page is selected
};

enum PegTreeSignals {
    PSF_NODE_SELECT = 8,    // sent when a new node is selected
    PSF_NODE_DELETE,        // sent when delete key pressed over node
    PSF_NODE_OPEN,          // sent when node is opened
    PSF_NODE_CLOSE,         // sent when node is closed
    PSF_NODE_RCLICK         // sent on RBUTTON clicked on selected node
};

enum PegTerminalSignals {
    PSF_COMMAND = 8         // sent when user types "Enter" on the
                            // terminal command line.
};


/*--------------------------------------------------------------------------*/
// System Status flags common to all object types
// These flags are maintained internally by PEG, but can be modified (at your
// own risk!) by the application level software.
/*--------------------------------------------------------------------------*/

const PEGULONG PSF_VISIBLE           = 0x00000001;
const PEGULONG PSF_CURRENT           = 0x00000002;
const PEGULONG PSF_SELECTABLE        = 0x00000004;
const PEGULONG PSF_SIZEABLE          = 0x00000008;
const PEGULONG PSF_MOVEABLE          = 0x00000010;
const PEGULONG PSF_NONCLIENT         = 0x00000020;
const PEGULONG PSF_ACCEPTS_FOCUS     = 0x00000040;
const PEGULONG PSF_KEEPS_CHILD_FOCUS = 0x00000080;
const PEGULONG PSF_DEFAULT_FOCUS     = 0x00000100;
const PEGULONG PSF_CONTINUOUS_SCROLL = 0x00000200;
const PEGULONG PSF_TAB_STOP          = 0x00000400;
const PEGULONG PSF_OWNS_POINTER      = 0x00000800;
const PEGULONG PSF_WINDOW_DERIVED    = 0x00001000;
const PEGULONG PSF_BUTTON_DERIVED    = 0x00002000;
const PEGULONG PSF_ALWAYS_ON_TOP     = 0x00004000;
const PEGULONG PSF_VIEWPORT          = 0x00008000;
const PEGULONG PSF_HIDDEN            = 0x00010000;


/*--------------------------------------------------------------------------*/
// PegWindow Scroll Modes
/*--------------------------------------------------------------------------*/
const PEGUBYTE WSM_VSCROLL       = 0x01;
const PEGUBYTE WSM_AUTOVSCROLL   = 0x02;
const PEGUBYTE WSM_HSCROLL       = 0x04;
const PEGUBYTE WSM_AUTOHSCROLL   = 0x08;
const PEGUBYTE WSM_AUTOSCROLL    = 0x0A;
const PEGUBYTE WSM_CONTINUOUS    = 0x80;

/*--------------------------------------------------------------------------*/
// a simple and fast variable swapping algorithm:
/*--------------------------------------------------------------------------*/

#define PEGSWAP(a, b) {a ^= b; b ^= a; a ^= b;}

/*--------------------------------------------------------------------------*/
// MIN and MAX and ABSDIFF macros
/*--------------------------------------------------------------------------*/

#define PEGMIN(a, b)  (a > b ? b:a)
#define PEGMAX(a, b)  (a > b ? a:b)
#define PEGABSDIFF(a, b)  ((a) > (b) ? (a)-(b) : (b)-(a))
#define PEG_ABS(a) (((a) < 0)?(-(a)):(a))

/*--------------------------------------------------------------------------*/
// macro for converting signal values to signal masks:
/*--------------------------------------------------------------------------*/

#define SIGMASK(a) ((PEGUSHORT) (1 << (a)))

#define ALL_SIGNALS_MASK 0x0F

/*--------------------------------------------------------------------------*/
// macro for catching signals given object ID and signal value:
/*--------------------------------------------------------------------------*/

#define PEG_SIGNAL(ID, SIG) (FIRST_SIGNAL + (ID << 4) + SIG)

/*--------------------------------------------------------------------------*/
// The definition BF_SEPARATOR was mis-spelled in earlier releases. To avoid
// compile problems with existing application code, we are temporarily
// definining the old spelling->new spelling. The old spelling will eventually
// be removed entirely.
/*--------------------------------------------------------------------------*/

#ifdef PEG_OBSOLETE_TYPES
#define BF_SEPERATOR BF_SEPARATOR
#define PEG_SS_SEPERATOR_WIDTH PEG_SS_SEPARATOR_WIDTH
#endif

/*--------------------------------------------------------------------------*/
// PegPoint definition:
/*--------------------------------------------------------------------------*/

struct PegPoint
{
    void Set(PEGINT InX, PEGINT InY)
    {
        x = (PEGSHORT) InX;
        y = (PEGSHORT) InY;
    }

    PEGBOOL operator != (const PegPoint &InPoint) const 
    {
        if (x != InPoint.x || y != InPoint.y)
        {
            return TRUE;
        }
        return FALSE;
    }
    PEGBOOL operator == (const PegPoint &InPoint) const
    {
        if (x == InPoint.x && y == InPoint.y)
        {
            return TRUE;
        }
        return FALSE;
    }
    PegPoint operator +(const PegPoint &Point) const
    {
        PegPoint NewPt;
        NewPt.Set(x + Point.x, y + Point.y);
        return NewPt;
    }

    PEGSHORT x;
    PEGSHORT y;

};


/*--------------------------------------------------------------------------*/
// Basic Colors- minimum pre-defined color set.
/*--------------------------------------------------------------------------*/

const PEGCOLOR CLR_TRANSPARENCY  =  PEG_DEF_TRANSPARENCY;
const PEGCOLOR CLR_BLACK         =  PEG_DEF_BLACK;
const PEGCOLOR CLR_WHITE         =  PEG_DEF_WHITE;

#if (PEG_NUM_COLORS > 2)
const PEGCOLOR CLR_LIGHTGRAY     =  PEG_DEF_LIGHTGRAY;
const PEGCOLOR CLR_DARKGRAY      =  PEG_DEF_DARKGRAY;

#if (PEG_NUM_COLORS > 4)

const PEGCOLOR CLR_RED           =  PEG_DEF_RED;
const PEGCOLOR CLR_GREEN         =  PEG_DEF_GREEN;
const PEGCOLOR CLR_BROWN         =  PEG_DEF_BROWN;
const PEGCOLOR CLR_BLUE          =  PEG_DEF_BLUE;
const PEGCOLOR CLR_MAGENTA       =  PEG_DEF_MAGENTA;
const PEGCOLOR CLR_CYAN          =  PEG_DEF_CYAN;
const PEGCOLOR CLR_LIGHTRED      =  PEG_DEF_LIGHTRED;
const PEGCOLOR CLR_LIGHTGREEN    =  PEG_DEF_LIGHTGREEN;
const PEGCOLOR CLR_YELLOW        =  PEG_DEF_YELLOW;
const PEGCOLOR CLR_LIGHTBLUE     =  PEG_DEF_LIGHTBLUE;
const PEGCOLOR CLR_LIGHTMAGENTA  =  PEG_DEF_LIGHTMAGENTA;
const PEGCOLOR CLR_LIGHTCYAN     =  PEG_DEF_LIGHTCYAN;

#endif  // more than 4 colors
#endif  // more than 2 colors





/*--------------------------------------------------------------------------*/
// The Peg Color Indices, passed when calls are made to 'SetColor'

const PEGUBYTE PCI_NORMAL          = 0;
const PEGUBYTE PCI_SELECTED        = 1;
const PEGUBYTE PCI_NTEXT           = 2;
const PEGUBYTE PCI_STEXT           = 3;

// Extended SpreadSheet color indexes:

const PEGUBYTE PCI_SS_COLHEADBACK = 4;
const PEGUBYTE PCI_SS_COLHEADTEXT = 5;
const PEGUBYTE PCI_SS_ROWHEADBACK = 6;
const PEGUBYTE PCI_SS_ROWHEADTEXT = 7;
const PEGUBYTE PCI_SS_DIVIDER     = 8;
const PEGUBYTE PCI_SS_BACKGROUND  = 9;

#define THING_COLOR_LIST_SIZE 4


/*--------------------------------------------------------------------------*/
// PegBitmap structure and flags definition.
//
// PegBitmap is a position-independant bitmap header that contains
// type and size information used by PegScreen.
/*--------------------------------------------------------------------------*/

#define   BMF_RAW          0x00     // bitmap is not RLE encoded
#define   BMF_RLE          0x01     // bitmap is RLE encoded
#define   BMF_NATIVE       0x02     // bitmap is in native video format
#define   BMF_555_FORMAT   0x04     // 16-bit bitmap is in 555 (not 565) format

#define   BMF_GRAYSCALE    0x08     // 1-8 bpp bitmap uses grayscale palette
#define   BMF_ARGB_FORMAT  0x08     // 16-bpp uses ARGB 4444 format

#define   BMF_HAS_TRANS    0x10     // bitmap uses transparency
#define   BMF_SPRITE       0x20     // bitmap resides in video memory

#define   BMF_RGB          0x40     // 16 or 24-bit bitmap is in RGB (not BGR) order
#define   BMF_332_FORMAT   0x40     // 8-bit bitmap is in 3:3:2 (not palette) format

#define   BMF_ALPHA        0x80     // bitmap has alpha channel (16 & 24bpp support only)


struct PegBitmap
{
    PEGUBYTE Flags;          // combination of flags above
    PEGUBYTE BitsPix;        // 1, 2, 4, 8, 16, or 24
    PEGUSHORT Width;         // in pixels
    PEGUSHORT Height;        // in pixels
    PEGULONG TransColor;     // transparent color for > 8bpp bitmaps
    PEGUBYTE PEGFAR *pStart;  // bitmap data pointer
};

#define IS_RLE(a) (a->Flags & BMF_RLE)
#define HAS_TRANS(a) (a->Flags & BMF_HAS_TRANS)
#define IS_NATIVE(a) (a->Flags & BMF_NATIVE)
#define IS_GRAYSCALE(a) (a->Flags & BMF_GRAYSCALE)
#define IS_SPRITE(a) (a->Flags & BMF_SPRITE)
#define IS_RGB(a) (a->Flags & BMF_RGB)
#define HAS_ALPHA(a) (a->Flags & BMF_ALPHA)
#define IS_332(a) (a->Flags & BMF_332_FORMAT)
#define IS_555(a) (a->Flags & BMF_555_FORMAT)





#endif

// End of file


